import type { EntityDto, IValidatableObject, PagedAndSortedResultRequestDto } from '../type';

export enum PublishType {
  Immediately,
  Delay
}
// TODO 该数据后期改为在数据库维护
export const publishTypeDict = new Map([
  [PublishType.Immediately, '立即执行'],
  [PublishType.Delay, '延迟执行']
]);

export interface AnnouncementDto extends EntityDto<string> {
  title: string;
  content: string;
  publishTime: Date;
  publishType: PublishType;
}

export interface AnnouncementCreateInputDto extends IValidatableObject {
  title: string;
  content: string;
  publishTime?: Date;
  publishType: PublishType;
  creatorName?: string;
}

export interface AnnouncementUpdateInputDto {
  title: string;
  content: string;
  publishTime: Date;
  publishType: PublishType;
}

export interface AnnouncementListDto extends AnnouncementDto {
  creatorName: string;
  creationTime: Date;
}

export interface AnnouncementGetListInputDto extends PagedAndSortedResultRequestDto {
  title?: string;
  publishType?: PublishType;
}
